package org.lzuploader.model.account;

import java.io.Serializable;

/**
 * This class is used to save data related to a server within an account.
 * For example, the username/password for a specific server will be saved here.
 * @author Emmanuel Cron
 *
 */
public class AccountServerConfig implements Serializable
{
    /**
     * Serial UID of this class.
     */
    private static final long serialVersionUID = 7098854362165939799L;

    /**
     * Server name.
     */
    private String server;
    
    /**
     * Username used to connect on server.
     */
    private String username;
    
    /**
     * Password used to connect on server (already hashed).
     */
    private String password;
    
    /**
     * Wether to save the password or  not.
     */
    private boolean saveAuthentification;
    
    /**
     * Creats a new object based on server name.
     * @param nServer The server name on which depends this object.
     */
    public AccountServerConfig(final String nServer)
    {
        server = nServer;
    }
    
    /**
     * Returns the server name on which depends this object.
     * @return The server name.
     */
    public String getServer()
    {
        return server;
    }
    
    /**
     * Returns the username used to connect on server.
     * @return The username.
     */
    public String getUsername()
    {
        return username;
    }

    /**
     * Sets the username used to connect on server.
     * @param nUsername The new username.
     */
    public void setUsername(final String nUsername)
    {
        username = nUsername;
    }
    
    /**
     * Returns the password used to connect on server.
     * @return An already hashed password.
     */
    public String getPassword()
    {
        return password;
    }
    
    /**
     * Sets the password used to connect on server.
     * @param nPassword The new password to use. It <b>must</b> be already hashed.
     */
    public void setPassword(final String nPassword)
    {
        password = nPassword;
    }
    
    /**
     * Returns wether the authentification is saveable or not.
     * @return <code>true</code> if authentification is saveable, <code>false</code> otherwise
     */
    public boolean isAuthentificationSaveable()
    {
        return saveAuthentification;
    }
    
    /**
     * Sets wether the authentification is saveable or not.
     * @param isSaveable <code>true</code> if authentification is saveable, <code>false</code> otherwise
     */
    public void setAuthentificationSaveable(final boolean isSaveable)
    {
        saveAuthentification = isSaveable;   
    }
}
